using System;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using EyeOpen.SampleCms.Web.Contents;

/// <summary>
/// Summary description for BasePage
/// </summary>
public class BasePage : Page
{
    private string description;

    private string keywords;

    public string Description
    {
        get { return description; }
        set { description = value; }
    }

    public string Keywords
    {
        get { return keywords; }
        set { keywords = value; }
    }

    protected override void OnPreRender(EventArgs e)
    {
        Title = SectionContents.CurrentSectionContent.Title;
        Description = SectionContents.CurrentSectionContent.Description;
        Keywords = SectionContents.CurrentSectionContent.Keywords;

        HtmlMeta hm;
        var head = Page.Header;
        head.Controls.AddAt(1, new LiteralControl("\n"));

        hm = new HtmlMeta();
        hm.Name = "Description";
        hm.Content = description;
        head.Controls.AddAt(2, hm);

        head.Controls.AddAt(3, new LiteralControl("\n"));

        hm = new HtmlMeta();
        hm.Name = "Keywords";
        hm.Content = keywords;
        head.Controls.AddAt(4, hm);
        head.Controls.AddAt(5, new LiteralControl("\n"));
    }
}